// mypage/userSign/userSign.js
var util=require("../../utils/util");

Page({
  /*页面的初始数据*/
  data: {
    value: '',
    num: 0
  },
  /*生命周期函数--监听页面加载*/
  onLoad: function (options) {
    var that=this;
    if(options.text!="null"){
      that.setData({value:options.text,num: (options.text).length})
    }
  },
  input_value:function(e){
    var val = e.detail.value, num = e.detail.cursor;
    var that = this;
    that.setData({value: val, num: num})
  },
  // 保存
  anv_back:function(){
    var that = this,val=that.data.value,testSpace = /^[ ]*$/g;
    var pages = getCurrentPages();
    var prevPage = pages[pages.length - 2];
    if(testSpace.test(val)){
      util.page_show_toast('请输入个性签名',2000)
      return false;
    }
    //
    prevPage.setData({text3: util.removeAllSpace(val)});
    wx.navigateBack({
      delta: 1
    });
  },
})